// @ts-ignore
/* eslint-disable */
import { request } from '@umijs/max';

/** 获取用户列表 */
export async function getUserList(params: API.User.userPageParam) {
  return request('/api/user', {
    method: 'GET',
    params,
  });
}

/** 新增用户 */
export async function addUser(data: API.User.userParam) {
  return request('/api/user/addUser', {
    method: 'POST',
    data,
  });
}

/** 修改用户 */
export async function updateUser(data: API.User.userParam) {
  return request('/api/user/updateUser', {
    method: 'POST',
    data,
  });
}

/** 删除用户 */
export async function deleteUser(id: string) {
  return request(`/api/user/deleteUser`, {
    method: 'delete',
    params: { id },
  });
}

/** 用户选择组件 */
export async function getSelect(params?: { position: string }) {
  return request(`/api/user/getSelect`, {
    method: 'GET',
    params,
  });
}

/** 用户修改密码 */
export async function updatePassword(data: { oldPassword: string; newPassword: string }) {
  return request(`/api/user/updatePassword`, {
    method: 'POST',
    data,
  });
}
